\section{network::xml\_\-filetype Class Reference}
\label{classnetwork_1_1xml__filetype}\index{network::xml_filetype@{network::xml\_\-filetype}}
This class implements a \doxyref{xml\_\-filetype}{p.}{classnetwork_1_1xml__filetype}, which can convert dom-nodes to formatted strings, and parse formatted strings to xml-nodes.  


{\tt \#include $<$xml\_\-filetype.h$>$}

Inheritance diagram for network::xml\_\-filetype::\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=3cm]{classnetwork_1_1xml__filetype}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
\bf{xml\_\-filetype} ()\label{classnetwork_1_1xml__filetype_1fbcc0c56c2c6c26e4cae5d721db21b9}

\item 
virtual \bf{$\sim$xml\_\-filetype} ()\label{classnetwork_1_1xml__filetype_e75758b6a8beea5fe502735b460db35b}

\item 
virtual boost::shared\_\-ptr$<$ \bf{model::dom} $>$ \bf{parse} (const string \&msg)
\begin{CompactList}\small\item\em parse parses a formatted string. \item\end{CompactList}\item 
virtual string \bf{send} (boost::shared\_\-ptr$<$ \bf{model::dom} $>$ dom)
\begin{CompactList}\small\item\em send converts a dom-node to a formatted string \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
This class implements a \doxyref{xml\_\-filetype}{p.}{classnetwork_1_1xml__filetype}, which can convert dom-nodes to formatted strings, and parse formatted strings to xml-nodes. 



Definition at line 53 of file xml\_\-filetype.h.

\subsection{Member Function Documentation}
\index{network::xml_filetype@{network::xml\_\-filetype}!parse@{parse}}
\index{parse@{parse}!network::xml_filetype@{network::xml\_\-filetype}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}boost::shared\_\-ptr$<$ \bf{model::dom} $>$ network::xml\_\-filetype::parse (const string \& {\em msg})\hspace{0.3cm}{\tt  [virtual]}}\label{classnetwork_1_1xml__filetype_9774358d70e4b26745ad083bf404f3a6}


parse parses a formatted string. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em msg}]is the formatted string which should be parsed\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]a shared\_\-ptr to a dom-node is returned. \end{Desc}


Implements \bf{network::parser} \doxyref{p.}{classnetwork_1_1parser_909e81aa801a156145f06939faf5e706}.

Definition at line 3 of file xml\_\-filetype.cpp.

\begin{Code}\begin{verbatim}4 {
5         _buff.append(msg.c_str(), msg.size());
6         if(_start_tag == "") {
7                 boost::regex expr("<([a-zA-Z]*).*?(/>|>).*");
8                 boost::cmatch what;
9                 boost::regex_match(msg.c_str(), what, expr);
10                 _start_tag = what[1];
11                 _end_in_start = what[2] == "/>";
12         }
13         
14         // check if end-tag is included in the message...
15         if(!_end_in_start) {
16                 string end_tag = "</" + _start_tag + ">";
17                 if(msg.find(end_tag) == std::string::npos) {
18                         throw parse_exception("Parse Error: " + msg);
19                 }
20         }
21 
22         xmlDocPtr doc = xmlReadMemory(_buff.c_str(), _buff.size(), 
23                 "noname.xml", "ISO-8859-1", 0);
24         if(doc) {
25                 _buff = "";
26                 _start_tag = "";
27                 boost::shared_ptr<model::dom> node(convert(doc));
28                 xmlFreeDoc(doc);
29                 xmlCleanupParser();
30                 return node;
31         } else {
32                 cout << endl << endl << "throwing-parse-Exception" << endl;
33                 xmlFreeDoc(doc); // watch out for teh evil memory leaks!!11
34                 xmlCleanupParser();
35                 throw parse_exception("Parse Error: " + msg);
36         }
37         // you never reach this code:
38         return boost::shared_ptr<model::dom>();
39 }
\end{verbatim}\end{Code}


\index{network::xml_filetype@{network::xml\_\-filetype}!send@{send}}
\index{send@{send}!network::xml_filetype@{network::xml\_\-filetype}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}string network::xml\_\-filetype::send (boost::shared\_\-ptr$<$ \bf{model::dom} $>$ {\em dom})\hspace{0.3cm}{\tt  [virtual]}}\label{classnetwork_1_1xml__filetype_3ecf43541f8f0cbfe5f2010c81daffdb}


send converts a dom-node to a formatted string 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dom}]is the dom-node which should be converted\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]a formatted string is returned. \end{Desc}


Implements \bf{network::sender} \doxyref{p.}{classnetwork_1_1sender_5d3ef325b6ff8ff08a9e2a0b25f4a8bd}.

Definition at line 90 of file xml\_\-filetype.cpp.

\begin{Code}\begin{verbatim}91 {
92         return dom->to_string();
93 }
\end{verbatim}\end{Code}




The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
network/xml\_\-filetype.h\item 
network/xml\_\-filetype.cpp\end{CompactItemize}
